import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 可销售食品信息 */
export interface SaleFood {
          id: number; // ID
          robotSn?: string; // 机器人SN
          robotBoxSn: string; // 机器人盒子SN
          canteenId?: number; // 餐厅ID
          menuId?: number; // 菜单ID
          price?: number; // 金额
          num?: number; // 数量
          mealDate?: string | Dayjs; // 餐食日期
          mealTimes?: number; // 餐次（1早餐、2午餐、3晚餐、4夜宵）
  }

// 可销售食品 API
export const SaleFoodApi = {
  // 查询可销售食品分页
  getSaleFoodPage: async (params: any) => {
    return await request.get({ url: `/rbt/sale-food/page`, params })
  },

  // 查询可销售食品详情
  getSaleFood: async (id: number) => {
    return await request.get({ url: `/rbt/sale-food/get?id=` + id })
  },

  // 新增可销售食品
  createSaleFood: async (data: SaleFood) => {
    return await request.post({ url: `/rbt/sale-food/create`, data })
  },

  // 修改可销售食品
  updateSaleFood: async (data: SaleFood) => {
    return await request.put({ url: `/rbt/sale-food/update`, data })
  },

  // 删除可销售食品
  deleteSaleFood: async (id: number) => {
    return await request.delete({ url: `/rbt/sale-food/delete?id=` + id })
  },

  /** 批量删除可销售食品 */
  deleteSaleFoodList: async (ids: number[]) => {
    return await request.delete({ url: `/rbt/sale-food/delete-list?ids=${ids.join(',')}` })
  },

  // 导出可销售食品 Excel
  exportSaleFood: async (params) => {
    return await request.download({ url: `/rbt/sale-food/export-excel`, params })
  }
}